package com.leetcode.dfs;

public class Leetcode1688 {

    public int numberOfMatches(int n) {
        int count = 0;
        while (n > 1) {
            if (n % 2 == 0) {
                n = n / 2;
                count += n;
            } else {
                n = n / 2;
                count += n;
                n += 1;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        System.out.println(new Leetcode1688().numberOfMatches(14));
    }
}
